/*
 * 查询会话
 * */

package com.axt.dbaudit.bean.query;

import com.axt.dbaudit.base.*;
import com.axt.dbaudit.model.query.*;
import java.util.*;

public class QuerySessionBean extends QueryBaseBean {
	public List<Session> getSessions() {
		try {
			return (List<Session>)getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<SessionDetail> getSessionDetails() {
		try {
			return (List<SessionDetail>)getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<SessionDetailHead> getSessionDetailHeads() {
		try {
			return (List<SessionDetailHead>)getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	/* query session indices */
	public int queryIndices(
			String serverPath, List<QueryFilter> filters, int queryInResult, int maxRowNum) {
		
		init();
		setQueryType(QueryType.QUERY_T_SES_IDX);
		setQueryInResult(queryInResult);
		setMaxRowNum(maxRowNum);
		setFilters(filters);
		
		return query(MsgFuncExt.FUNC_QUERY_QUERY_INDEX, serverPath);
	}
	
	/* query sessions */
	public int querySessions(String serverPath, List<QueryFilter> filters) {
		
		init();
		setQueryType(QueryType.QUERY_T_SESSION);
		setFilters(filters);
		
		return query(
				MsgFuncExt.FUNC_QUERY_QUERY_DATA, serverPath, 
				"com.axt.dbaudit.model.query.Session");
	}
	
	/* query process maxRowNul = 0 */
	public int queryProcess(String serverPath, List<QueryFilter> filters) {
		
		init();
		setQueryType(QueryType.QUERY_T_SESSION);
		setMaxRowNum(0);
		setFilters(filters);
		
		return query(
				MsgFuncExt.FUNC_QUERY_QUERY_DATA, serverPath, 
				"com.axt.dbaudit.model.query.Session");
	}
	
	
	/* stop query session indices */
	public int stopQueryIndices(String serverPath){
		
		init();
		setQueryType(QueryType.QUERY_T_SES_IDX);
		
		return query(MsgFuncExt.FUNC_QUERY_STOP_LIST_IDX, serverPath);
	}
	
	/* query sessions details */
	public int querySessionDetail(String serverPath, List<QueryFilter> filters) {
		
		init();
		setQueryType(QueryType.QUERY_T_SES_DETAIL);
		setFilters(filters);
		
		return query(
				MsgFuncExt.FUNC_QUERY_QUERY_DATA, serverPath, 
				"com.axt.dbaudit.model.query.SessionDeail");
	}
	
	/* query sessions head */
	public int querySessionHead(String serverPath, List<QueryFilter> filters) {
		
		init();
		setQueryType(QueryType.QUERY_T_SES_HEAD);
		setFilters(filters);
		
		return query(
				MsgFuncExt.FUNC_QUERY_QUERY_DATA, serverPath, 
				"com.axt.dbaudit.model.query.SessionHead");
	}
	
}
